<template>
	<view class="page">
		<view class="items" v-for="(items,index) in shiList" :key="items.id" @click="chooseCity(items)">
			{{items.name}}
		</view>
		<!-- 		<view class="cose" @click="end">
			X
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shiqu:[],
				shiList: [],
				provinceId: null,
			}
		},
		// onPageScroll(e) {
		// 	this.scrollTop = e.scrollTop
		// },
		created() {
			this.getUser()
		},
		onInit() {

		},

		methods: {
			// 获取城市
			getCityTree() {
				this.$axios.request(this.$api.getCityApi, "GET", {
					hasTowner: 1,
					pid: this.provinceId
				}).then((val) => {
					this.shiList = val.data
				})
			},
			getUser() {
				this.$axios.request(this.$api.getUser, "GET").then((val) => {
					this.provinceId = val.data.provinceId
					this.getCityTree()
				})
			},
			chooseCity(city) {
				this.shiqu[0] = {...city}
				let d = JSON.stringify(this.shiqu)
				uni.navigateTo({
					url:`/pages/index/district?data=${d}`
				})
			
			},
		}
	}
</script>

<style>
	.page {
		width: 100%;
		height: 100vh;
		background-color: #fff;
		overflow-y: auto;
		padding-bottom: 60rpx;
	}

	.items {
		width: 100%;
		padding: 0 24rpx;
		height: 60rpx;
		/* background-color: red; */
		border-bottom: 2rpx solid #eee;
		line-height: 60rpx;
	}

	.cose {
		position: fixed;
		right: 30rpx;
		bottom: 60rpx;
		width: 85rpx;
		height: 85rpx;
		background-color: #3975EA;
		border-radius: 42.50rpx;
		text-align: center;
		line-height: 85rpx;
		color: #FFFFFF;
		z-index: 999;

	}
</style>
